package com.ibeeking.found.msg.rest.service;

import com.ibeeking.found.msg.api.common.query.SubscribeQuery;
import com.ibeeking.found.msg.service.common.bo.WxMpFansBO;
import com.ibeeking.found.msg.service.common.bo.WxMpFansIdBO;
import com.ibeeking.found.msg.service.common.dos.WxMpFansDO;
import com.ibeeking.found.msg.service.common.param.WxMpFansParam;
import com.ibeeking.found.msg.service.common.query.WxMpFansPageQuery;
import com.ibeeking.found.msg.service.common.vo.WxMpFansPageVO;
import com.ibeeking.found.msg.service.common.vo.WxMpFansVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * IWxMpFansService
 *
 * @Author ibeeking
 * @Date 2020-12-30 14:12
 */
public interface IWxMpFansService extends IService<WxMpFansDO> {

    /**
     * 同步粉丝数据
     *
     * @param appId
     * @return
     */
    Boolean syncFansFromWx(String appId);

    /**
     * 导出数据
     *
     * @param wxMpFansPageQuery
     * @return
     */
    Boolean export(WxMpFansPageQuery wxMpFansPageQuery);

    /**
     * 分页条件查询
     *
     * @param wxMpFansPageQuery
     * @return
     */
    Page<WxMpFansPageVO> pageList(WxMpFansPageQuery wxMpFansPageQuery);

    /**
     * 修改粉丝信息
     *
     * @param wxMpFansParam
     * @return
     */
    Boolean modify(WxMpFansParam wxMpFansParam);

    /**
     * 查看粉丝信息
     *
     * @param id
     * @return
     */
    WxMpFansVO view(String appId, Long id);

    /**
     * 查询
     *
     * @param id
     * @return
     */
    WxMpFansBO queryByFansId(Long id);

    /**
     * 查询符合条件的粉丝id
     *
     * @param query
     * @return
     */
    List<Long> queryFansList(WxMpFansPageQuery query);

    /**
     * 更新所有粉丝的发送次数
     *
     * @param appId
     * @return
     */
    Boolean updateAllFansSendCount(String appId);

    /**
     * 根据openIds批量更新发送次数
     *
     * @param fansDOS
     * @param batch
     * @return
     */
    Boolean updateFansSendCountByIdsBatch(List<WxMpFansDO> fansDOS, int batch);

    /**
     * 根据条件查询返回粉丝id和openid
     *
     * @param query
     * @return
     */
    List<WxMpFansIdBO> queryFansId(WxMpFansPageQuery query);

    WxMpFansBO queryByOpenId(String openId);

    WxMpFansBO queryByAppIdAndOpenId(String appId, String openId);

    Boolean add(WxMpFansDO wxMpFansDO);

    Boolean modifyInfo(WxMpFansDO wxMpFansDO);

    /**
     * 查询关注/非关注
     *
     * @param query
     * @return
     */
    List<String> subscribeQuery(SubscribeQuery query);

    /**
     * 查询openIds
     *
     * @param unionIds
     * @return
     */
    List<String> queryOpenIds(List<String> unionIds);
}
